<?php
/**
 * +--------------------------------------------------------+
 * @Created by Phpstorm.
 * @Category 2022_04_17_162600_create_stocks_table.php
 * @Depiction
 * @Author hwy <429208948@qq.com>
 * @Date 2022/4/17  16:41
 * +--------------------------------------------------------+
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateMyStocksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('my_stocks', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('code', 10);
            $table->decimal('cost', 10,2);
            $table->decimal('add_cost', 10,2)->nullable()->comment('加入价格');
            $table->integer('warm')->nullable()->comment('提醒');
            $table->integer('attention')->nullable()->comment('关注');
            $table->smallInteger('is_init')->nullable()->comment('是否初始化历史数据1，未初始化，2已初始化');
            $table->smallInteger('is_fina')->nullable()->comment('是否初始化财务数据');
            $table->smallInteger('is_real')->nullable()->comment('是否获取实时数据');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `la_my_stocks` comment '我的股票列表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('my_stocks');
    }
}

